import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import home from '@/pages/Index.vue';
import login from '@/pages/Login/index.vue';
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'home',
    component: home
  },
  {
    path: '/login',
    name: 'login',
    component: login
  }
  // {
  //   path: "/about",
  //   name: "About",
  //   component: () =>
  //     import("../views/About.vue")
  // }
];

const router = createRouter({
  history: createWebHistory(),
  routes
});
router.beforeEach((to, from, next) => {
  // if (to.name !== 'login') {
  //   const access_token = sessionStorage.getItem('access_token');
  //   if (access_token) {
  //     next();
  //   } else {
  //     router.push({ name: 'login' });
  //   }
  // }
  next();
});

export default router;
